<template>
  <view class="confirm-cent">
    <view class="confirm-title">
      <text v-if="payStatus == 1">支付成功</text>
      <text v-else>支付失败</text>
    </view>
    <view class="confirm-text" v-if="payStatus == 1">订单支付成功,我们将尽快依次发货,请耐心等待</view>
    <view class="btn goHome" @click="goHome">回到首页</view>
    <view class="btn viewOrder" @click="goOrderList">查看订单</view>
  </view>
</template>

<script>
import { checkPay } from '@/service/purchaseShop/goods.service.js';
export default {
  data () {
    return {
      payId: '',
      paramsObj: {},
      payStatus: '' // -1已取消 0待支付 1已支付
    }
  },
  onLoad:function(option) {
    this.payId = option.payId;
  },
  onShow() {
    this.getCheckPay()
  },
  methods: {
    getCheckPay () {
      // if (!this.paramsObj.payId) {
      //   this.payStatus = 1
      //   return
      // }
      var params = {
        id: this.payId
      }
      checkPay(params, res => {
        this.payStatus = res.data
      })
    },
    goHome () {
      uni.navigateTo({
        url:'/pages/purchaseShop/index'
      })
    },
    goOrderList () {
      uni.navigateTo({
        url: '/pages/purchaseShop/orderList?type=-1'
      })
    }
  }
}
</script>

<style scoped lang="scss">
.confirm-cent{
  background: #FFFFFF;
  text-align: center;
  padding-top: 72rpx;
  padding-bottom: 144rpx;
  .confirm-title{
    height: 78rpx;
    line-height: 78rpx;
    color: #333333;
    text{
      padding-left: 94rpx;
      display: inline-block;
      background: url(../../static/image/paymentResult.png) left center no-repeat;
      background-size: auto 78rpx;
    }
  }
  .confirm-text{
    line-height: 40rpx;
    font-size: 24rpx;
    color: #333333;
    margin-top: 20rpx;
    margin-bottom: 58rpx;
  }
  .btn {
    display: inline-block;
    width: 324rpx;
    height: 84rpx;
    line-height: 84rpx;
    font-size: 28rpx;
    border-radius: 168rpx;
    margin-top: 40rpx;
  }
  .goHome{
    border:2rpx solid #f3d0cd;
    color: #cf493f;
    margin-right: 26rpx;
  }
  .viewOrder{
    border:2rpx solid #d8d8d8;
    color: #676767;
  }
}
</style>
